<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>编辑分类</title>
    <#assign base=request.contextPath/>
    <#setting  number_format="0.##"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${base}/backstage/layui/css/layui.css" media="all">
    <script src="${base}/backstage/layui/layui.js?t=1"></script>
    <script src="${base}/backstage/js/jquery-1.8.3.min.js?t=1"></script>
    <script src="${base}/backstage/js/feng.js?t=1"></script>
    <script src="${base}/backstage/js/loading.js?t=1"></script>
</head>
<body>

<br>
<form class="layui-form " action="" style="padding-left: 15px;">
    <input type="hidden" value="${attributeClassification.id}" id="id"/>

    <div class="layui-form-item">
        <label class="layui-form-label">分类名称</label>
        <div class="layui-input-block">
            <input class="layui-input" value="${attributeClassification.attributeClassification}" name="attributeClassification" id="attributeClassification" placeholder="请输入分类名称" autocomplete="off">
        </div>
    </div>


    <div align="center">
        <button type="button" class="layui-btn" id="saveButton">保存</button>
        <button type="button" class="layui-btn" onclick="window.history.back(-1);">返回</button>
    </div>
    <br>
    <br>
</form>
<script>


    var param = "";
    layui.use(['form', 'layer', 'upload'], function () {
        var form = layui.form
            , layer = layui.layer
            , $ = layui.jquery
            , upload = layui.upload;


    })

    $("#saveButton").on("click", function () {

        if ($("#attributeClassification").val() == "") {
            layer.msg("分类名称不能为空")
            return;
        }

        var formDate = {
            attributeClassification: $("#attributeClassification").val(),
            id: $("#id").val()
        }

        $.ajax({
            type: "POST",
            contentType: "application/json;charset=UTF-8",
            url: "${base}/admin/attributeClassification/saveOrUpdateById",
            data: JSON.stringify(formDate),
            beforeSend: function () {
                loading("数据提交中，请稍后......");
            },
            success: function (data) {
                if (data.code === 200) {
                    layer.msg(data.msg)
                    window.location.href = "${base}/admin/attributeClassification/attributeClassification.html"
                } else {
                    layer.msg(data.msg)
                }
            }
        });
    })
</script>

</body>
</html>